<?php
class BaseAction
{
    private $_model;
    private $_controller;
    private $_segment_array;

    public function prepare($c, $className, $segment_array)
    {
        $this->_segment_array = $segment_array;
        $currentActionName = $className;
        $currentActionName = str_replace("Action", "", $currentActionName);
        $modelName = $currentActionName . "Model";
        $c->load->model($modelName);
        $this->_model = $c->$modelName;
        $this->_controller = $c;
    }


    public function setModel($model)
    {
        $this->_model = $model;
    }

    public function getModel()
    {
        return $this->_model;
    }

    public function setController($controller)
    {
        $this->_controller = $controller;
    }

    public function getController()
    {
        return $this->_controller;
    }

    public function setSegmentArray($segment_array)
    {
        $this->_segment_array = $segment_array;
    }

    public function getSegmentArray()
    {
        return $this->_segment_array;
    }


}